package com.woniu.cms.lease.core.controller;


import com.woniu.cms.lease.core.entity.LeaseStorage;
import com.woniu.cms.lease.core.service.impl.LeaseStorageServiceImpl;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author romantic sheep
 * @since 2022-09-18
 */
@RestController
@RequestMapping("/lease-storage")
@Api(tags = "仪器入库")
public class LeaseStorageController {
    @Autowired
    private LeaseStorageServiceImpl leaseStorageService;

    @GetMapping("/al")
    @ApiOperation("测试plus")
    public Result test(){
        List<LeaseStorage> list = leaseStorageService.list();
        return Result.common(list);
    }

    @GetMapping("/all")
    @ApiOperation("查询所有仪器")
    public Result all(){
        List<LeaseStorage> all = leaseStorageService.all();
        return Result.common(all);
    }

    @PostMapping("/insert")
    @ApiOperation("新增仪器")
    public int add(@RequestBody LeaseStorage leaseStorage){
        
        int add = leaseStorageService.add(leaseStorage);
        return add;
    }

    @PutMapping("{id}")
    @ApiOperation("修改状态")
    public int status(@PathVariable int id){
        int revise = leaseStorageService.Revise(id);
        return revise;

    }
}

